<?php
	require_once('model/User.php');
	require_once('model/Question.php');
	require_once('model/CarDeveloper.php');
	require_once('model/CarModel.php');
	require_once('model/Car.php');
	
	final class Cars extends Controller{
	
		public function Index(){
			$this->stylesheet = 'Car-list';
			$this->headers['Content-type'] = 'text/html';
		}
		
		public function CarList(){
			$this->stylesheet = 'Car-list';
			if($this->params['status'] == 'salon') $status = CAR_STATUS_SALON;
			else if($this->params['status'] == 'byowner') $status = CAR_STATUS_BYOWNER;
			else if($this->params['status'] == 'asorder') $status = CAR_STATUS_ASORDER;
			$this->page->MountSource(Car::CarsByDeveloper($this->params['developer'],$status,CAR_ACTIVE_SHOW));			
		}
		
		public function CarInfo(){
			$this->stylesheet = 'Car-info';
			$infoId = (int)$this->params['infoId'];
			$car = new Car();
			$car->InfoId($infoId);
			$car->Load();
			$this->page->MountSource($car->AsSource());
		}
		
	}